import lessModule from "./index.module.less"
import HomePage_ModalComponent_HeaderNormalComponent from "../headerNormal";
import HomePage_ModalComponent_NormalFooterComponent from "../normalFooter";
import HomePage_ModalComponent_CancelAndSubmitFooterComponent from "../cancelAndSubmitFooter";
import { $eventBus } from "../../../../../../common/utils";


// 主页-弹窗组件-确认弹窗组件
interface componentInterface {
    title: string
    content: string
    operation: string
    operationBgc?:string
    sourceData?: object
    change_cancel: Function
}

const HomePage_ModalComponent_ConfirmationModallComponent: React.FC<componentInterface> = (props) => {

    
    const change_danger = () => {
        setTimeout(() => {
            $eventBus.emit("confirmOperation", { source: "HomePage_ModalComponent_ConfirmationModallComponent", explain: "请执行刪除弹窗的确认删除事件,并获取最新的数据", data: props.sourceData })
        }) 
    }
    return (
        <div className={lessModule["homePageModalComponentConfirmationModalComponent"]}>
            <HomePage_ModalComponent_HeaderNormalComponent name={props.title} padding="0 0 25px" fontSize={24} isBorderBottomHide change_cancel={props.change_cancel} />
            <main className={lessModule["homePageModalComponentConfirmationModalComponent-main"]}>{props.content}</main>
            <HomePage_ModalComponent_CancelAndSubmitFooterComponent flexGap={20} fontSize={16} isDanger dangerName={props.operation} dangerBgc={props.operationBgc} cancelNotIsGhost change_danger={change_danger} change_cancel={props.change_cancel} />
        </div>
    )
}
export default HomePage_ModalComponent_ConfirmationModallComponent